package com.linkq.ipinyin.controller;

import com.linkq.ipinyin.model.ExamPaper;
import com.linkq.ipinyin.model.ExamPaperQuestionCustomerAnswer;
import com.linkq.ipinyin.model.vo.ExamAnswerVo;
import com.linkq.ipinyin.service.ExamPaperService;
import com.linkq.ipinyin.vo.ResultInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @FileName ExamPaperController
 * @Description
 * @Author wangpeng
 * @date 2024-12-04
 **/

@RestController
@RequestMapping("exam")
public class ExamPaperController {

    @Autowired
    private ExamPaperService examPaperService;

    /**
     * 提交考试答案
     * @param examAnswer
     * @return
     */
    @PostMapping("submitExam")
    public ResultInfo submitExam(@RequestBody ExamAnswerVo examAnswer){
        return ResultInfo.success(examPaperService.submitExam(examAnswer));
    }

    @PostMapping("getExamByCondition")
    public ResultInfo getExamByCondition(@RequestBody ExamPaper examPaper) {
        return ResultInfo.success(examPaperService.getExamByCondition(examPaper));
    }

    @PostMapping("getWrongQuestion")
    public ResultInfo getWrongQuestion(@RequestBody ExamPaperQuestionCustomerAnswer examPaperQuestionCustomerAnswer) {
        return ResultInfo.success(examPaperService.getWrongQuestion(examPaperQuestionCustomerAnswer));
    }
}
